Exercise Sheet 3 - Master Solution Exercise 1 - Comparisons in Quicksort

نویسندگان

  • Thomas Holenstein
  • Ueli Maurer
  • Angelika Steger
  • Emo Welzl
  • Peter Widmayer
چکیده

Exercise 1 Comparisons in Quicksort To begin with, note that when we talk about the ’number of comparisons’, we mean the number of times one element is compared to another element of the sequence to sort. We do not count internal comparisons of the algorithm (like when the algorithm compares the index of an element to another index). Let a, b be two distinct elements of rank i and j, respectively. In the script (cf. page 22), a mapping is described from the possible runs of quicksort(S) to binary search trees (with the same distribution as our random search trees). According to that mapping, a, b are compared in quicksort(S) if and only if in the corresponding search tree, either b is the ancestor of a or a is the ancestor of b. We have denoted these events using indicator variables by Aji = 1 and A i j = 1, respectively.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Cm20019—computation Iii: Formal Logic and Semantics Exercise Sheet 9, 23.11.2007 Alessio Guglielmi

Problem 1. Write a Prolog program, consisting only of pure Horn clauses, that orders a list of natural numbers by the quicksort algorithm. Problem 2. Write a Prolog program, consisting only of pure Horn clauses, that computes all permutations of a given list. Problem 3. Write a Prolog program, consisting only of pure Horn clauses, that nds all normal magic squares of order 3. Please consult Wik...

متن کامل

Percolation Ariel Yadin Exercise

Exercise Sheet # 2 Exercise 1. Show that the event that there exists an infinite component is translation invariant. Solution to Exercise 1. If ϕ ∈ Aut(G) then ϕ maps infinite connected subsets to infinite connected subsets. So if ω is a subgraph containing an infinite component , then ϕω also contains an infinite component. Also, if ω contains only finite components, then ϕω contains only fini...

متن کامل

Analysis of String Sorting using Heapsort

In this master thesis we analyze the complexity of sorting a set of strings. It was shown that the complexity of sorting strings can be naturally expressed in terms of the prefix trie induced by the set of strings. The model of computation takes into account symbol comparisons and not just comparisons between the strings. The analysis of upper and lower bounds for some classical algorithms such...

متن کامل

Pushing the Limits in Sequential Sorting

With re nements to the WEAK-HEAPSORT algorithm we establish the general and practical relevant sequential sorting algorithm RELAXED-WEAK-HEAPSORT executing exactly ndlog ne 2 ne + 1 n log n 0:9n comparisons on any given input. The number of transpositions is bounded by n plus the number of comparisons. Experiments show that RELAXED-WEAK-HEAPSORT only requires O(n) extra bits. Even if this space...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2013